package org.lqk.kafka.server;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.messaging.Message;

/**
 * Created by bert on 16/10/17.
 */
public class Consumer {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("application-kafka-server-context.xml");
        QueueChannel queueChannel = (QueueChannel) context.getBean("inputFromKafka");
        Message msg = null;
        while ((msg = queueChannel.receive(-1)) != null) {
            String map = (String) msg.getPayload();
            System.out.println(map);
        }
    }

}
